package ddu.service;

import java.util.List;

import ddu.dao.UserDao;
import ddu.dao.UserDaoImpl;
import ddu.entity.User;

public class UserServiceImpl implements UserService {

	private UserDao userDao = new UserDaoImpl();

	@Override
	public List<User> findUserList() {
		return userDao.selectList();
	}

	@Override
	public User findById(int id) {
		return userDao.selectById(id);
	}

	@Override
	public Boolean remove(int id) {
		return userDao.deleteById(id);
	}

	@Override
	public Boolean modify(int id, String sex, String name, String pwd, String address, String info) {
		User user = new User(id, sex, name, pwd, address, info);
		return userDao.update(user);
	}

	@Override
	public Boolean add(String sex, String name, String pwd, String address, String info) {
		User user = new User(sex, name, pwd, address, info);
		return userDao.insert(user);
	}

}
